﻿namespace UnityEditor
{
    using System;
    using System.Collections.Generic;
    using UnityEngine;

    [Serializable]
    internal class FoldoutTree
    {
        private bool m_Locked;
        private FoldoutObjectState[] m_States;

        public FoldoutTree(Transform tr, SerializedStringTable expandedFoldouts)
        {
            List<FoldoutObjectState> states = new List<FoldoutObjectState>();
            new FoldoutObjectState(tr.gameObject, states, expandedFoldouts, 0);
            this.m_States = states.ToArray();
        }

        public void Refresh(AnimationHierarchyData data)
        {
            this.root.Show(data, 0);
        }

        public bool locked
        {
            get
            {
                return this.m_Locked;
            }
            set
            {
                this.m_Locked = value;
            }
        }

        public FoldoutObjectState root
        {
            get
            {
                return this.states[0];
            }
        }

        public GameObject rootGameObject
        {
            get
            {
                return this.root.obj;
            }
        }

        public Transform rootTransform
        {
            get
            {
                return this.root.obj.transform;
            }
        }

        public FoldoutObjectState[] states
        {
            get
            {
                return this.m_States;
            }
        }
    }
}

